package cn.demo.app.a.impl;

import cn.demo.app.a.domain.Sex;
import cn.demo.app.a.domain.User;
import cn.demo.app.a.domain.vo.UserVo;
import cn.demo.app.a.mappers.UserMapper;
import cn.demo.app.a.service.UserService;
import cn.ifloat.brick.basic.common.toolkit.Maper;
import cn.ifloat.brick.sprofile.cache.annonation.BCacheable;
import cn.ifloat.brick.sprofile.mybatis.common.BasicServiceImpl;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @className: UserServiceImpl
 * @describe: 2022/10/7 16:57
 * @author: Yinzhigang
 * @createTime 2017年2月20日 下午8:23:52
 */
@Service
public class UserServiceImpl extends BasicServiceImpl<UserMapper, User> implements UserService {
    /**
     *

     ${current.id}
     ${current.orgId}
     ${args[1].}
     */
//    @BCacheable(group = "USER_", key = "BU${args[1]}", putOrDelete = true)
    @Override
    public User builderUser(Integer ii,String ss) {
        User user = new User();
        user.setCreateTime(new Date());
        user.setId(2L);
        user.setName("float");
        user.setSex(Sex.woman);
        return user;
    }
    @Override
//    @BCacheable(group = "USER_", key = "BM", putOrDelete = true)
    public String builderStr() {
        return "builderStr";
    }

    @Override
    public List<UserVo> listVo() {
        return getBaseMapper().listVo();
    }

    @Override
    public List<UserVo> listAll() {
        return getBaseMapper().listAll();
    }

    //    @BCacheable(group = "USER_", key = "BS", putOrDelete = true)
    @Override
    public Map<String, Object> builderMap() {
        return Maper.<String, Object>builder().of("A", "AV").of("B", "BV").of("C", "CV").get();
    }
}
